package com.zhengxin.controller;

import com.alibaba.fastjson.JSONObject;
import com.zhengxin.results.WebResult;
import com.zhengxin.service.RegisterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import static com.zhengxin.results.WebResult.REQUEST_STATUS_SUCCESS;

@RestController
@Api("注册接口")
public class RegisterController {

    @Autowired
    RegisterService registerService;

    @PostMapping("register")
    @ApiOperation("注册接口")
    public WebResult<String> register(@RequestBody JSONObject jsonObject) {
        return WebResult.<String>builder()
                .code(200)
                .data(registerService.register(jsonObject))
                .message(REQUEST_STATUS_SUCCESS)
                .build();
    }
}
